home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc-2.6.3-bin.lha / GNU / info / gcc.info-13 (.txt) < prev    next >
GNU Info File  |  1995-03-30  |  45KB  |  789 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation,
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License," "Funding for
  13. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  14. included exactly as in the original, and provided that the entire
  15. resulting derived work is distributed under the terms of a permission
  16. notice identical to this one.
  17.    Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that the sections entitled "GNU General Public
  20. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  21. `Look And Feel'", and this permission notice, may be included in
  22. translations approved by the Free Software Foundation instead of in the
  23. original English.
  24. File: gcc.info,  Node: Regs and Memory,  Next: Arithmetic,  Prev: Constants,  Up: RTL
  25. Registers and Memory
  26. ====================
  27.    Here are the RTL expression types for describing access to machine
  28. registers and to main memory.
  29. `(reg:M N)'
  30.      For small values of the integer N (those that are less than
  31.      `FIRST_PSEUDO_REGISTER'), this stands for a reference to machine
  32.      register number N: a "hard register".  For larger values of N, it
  33.      stands for a temporary value or "pseudo register".  The compiler's
  34.      strategy is to generate code assuming an unlimited number of such
  35.      pseudo registers, and later convert them into hard registers or
  36.      into memory references.
  37.      M is the machine mode of the reference.  It is necessary because
  38.      machines can generally refer to each register in more than one
  39.      mode.  For example, a register may contain a full word but there
  40.      may be instructions to refer to it as a half word or as a single
  41.      byte, as well as instructions to refer to it as a floating point
  42.      number of various precisions.
  43.      Even for a register that the machine can access in only one mode,
  44.      the mode must always be specified.
  45.      The symbol `FIRST_PSEUDO_REGISTER' is defined by the machine
  46.      description, since the number of hard registers on the machine is
  47.      an invariant characteristic of the machine.  Note, however, that
  48.      not all of the machine registers must be general registers.  All
  49.      the machine registers that can be used for storage of data are
  50.      given hard register numbers, even those that can be used only in
  51.      certain instructions or can hold only certain types of data.
  52.      A hard register may be accessed in various modes throughout one
  53.      function, but each pseudo register is given a natural mode and is
  54.      accessed only in that mode.  When it is necessary to describe an
  55.      access to a pseudo register using a nonnatural mode, a `subreg'
  56.      expression is used.
  57.      A `reg' expression with a machine mode that specifies more than
  58.      one word of data may actually stand for several consecutive
  59.      registers.  If in addition the register number specifies a
  60.      hardware register, then it actually represents several consecutive
  61.      hardware registers starting with the specified one.
  62.      Each pseudo register number used in a function's RTL code is
  63.      represented by a unique `reg' expression.
  64.      Some pseudo register numbers, those within the range of
  65.      `FIRST_VIRTUAL_REGISTER' to `LAST_VIRTUAL_REGISTER' only appear
  66.      during the RTL generation phase and are eliminated before the
  67.      optimization phases.  These represent locations in the stack frame
  68.      that cannot be determined until RTL generation for the function
  69.      has been completed.  The following virtual register numbers are
  70.      defined:
  71.     `VIRTUAL_INCOMING_ARGS_REGNUM'
  72.           This points to the first word of the incoming arguments
  73.           passed on the stack.  Normally these arguments are placed
  74.           there by the caller, but the callee may have pushed some
  75.           arguments that were previously passed in registers.
  76.           When RTL generation is complete, this virtual register is
  77.           replaced by the sum of the register given by
  78.           `ARG_POINTER_REGNUM' and the value of `FIRST_PARM_OFFSET'.
  79.     `VIRTUAL_STACK_VARS_REGNUM'
  80.           If `FRAME_GROWS_DOWNWARD' is defined, this points to
  81.           immediately above the first variable on the stack.
  82.           Otherwise, it points to the first variable on the stack.
  83.           `VIRTUAL_STACK_VARS_REGNUM' is replaced with the sum of the
  84.           register given by `FRAME_POINTER_REGNUM' and the value
  85.           `STARTING_FRAME_OFFSET'.
  86.     `VIRTUAL_STACK_DYNAMIC_REGNUM'
  87.           This points to the location of dynamically allocated memory
  88.           on the stack immediately after the stack pointer has been
  89.           adjusted by the amount of memory desired.
  90.           This virtual register is replaced by the sum of the register
  91.           given by `STACK_POINTER_REGNUM' and the value
  92.           `STACK_DYNAMIC_OFFSET'.
  93.     `VIRTUAL_OUTGOING_ARGS_REGNUM'
  94.           This points to the location in the stack at which outgoing
  95.           arguments should be written when the stack is pre-pushed
  96.           (arguments pushed using push insns should always use
  97.           `STACK_POINTER_REGNUM').
  98.           This virtual register is replaced by the sum of the register
  99.           given by `STACK_POINTER_REGNUM' and the value
  100.           `STACK_POINTER_OFFSET'.
  101. `(subreg:M REG WORDNUM)'
  102.      `subreg' expressions are used to refer to a register in a machine
  103.      mode other than its natural one, or to refer to one register of a
  104.      multi-word `reg' that actually refers to several registers.
  105.      Each pseudo-register has a natural mode.  If it is necessary to
  106.      operate on it in a different mode--for example, to perform a
  107.      fullword move instruction on a pseudo-register that contains a
  108.      single byte--the pseudo-register must be enclosed in a `subreg'.
  109.      In such a case, WORDNUM is zero.
  110.      Usually M is at least as narrow as the mode of REG, in which case
  111.      it is restricting consideration to only the bits of REG that are
  112.      in M.
  113.      Sometimes M is wider than the mode of REG.  These `subreg'
  114.      expressions are often called "paradoxical".  They are used in
  115.      cases where we want to refer to an object in a wider mode but do
  116.      not care what value the additional bits have.  The reload pass
  117.      ensures that paradoxical references are only made to hard
  118.      registers.
  119.      The other use of `subreg' is to extract the individual registers of
  120.      a multi-register value.  Machine modes such as `DImode' and
  121.      `TImode' can indicate values longer than a word, values which
  122.      usually require two or more consecutive registers.  To access one
  123.      of the registers, use a `subreg' with mode `SImode' and a WORDNUM
  124.      that says which register.
  125.      Storing in a non-paradoxical `subreg' has undefined results for
  126.      bits belonging to the same word as the `subreg'.  This laxity makes
  127.      it easier to generate efficient code for such instructions.  To
  128.      represent an instruction that preserves all the bits outside of
  129.      those in the `subreg', use `strict_low_part' around the `subreg'.
  130.      The compilation parameter `WORDS_BIG_ENDIAN', if set to 1, says
  131.      that word number zero is the most significant part; otherwise, it
  132.      is the least significant part.
  133.      Between the combiner pass and the reload pass, it is possible to
  134.      have a paradoxical `subreg' which contains a `mem' instead of a
  135.      `reg' as its first operand.  After the reload pass, it is also
  136.      possible to have a non-paradoxical `subreg' which contains a
  137.      `mem'; this usually occurs when the `mem' is a stack slot which
  138.      replaced a pseudo register.
  139.      Note that it is not valid to access a `DFmode' value in `SFmode'
  140.      using a `subreg'.  On some machines the most significant part of a
  141.      `DFmode' value does not have the same format as a single-precision
  142.      floating value.
  143.      It is also not valid to access a single word of a multi-word value
  144.      in a hard register when less registers can hold the value than
  145.      would be expected from its size.  For example, some 32-bit
  146.      machines have floating-point registers that can hold an entire
  147.      `DFmode' value.  If register 10 were such a register `(subreg:SI
  148.      (reg:DF 10) 1)' would be invalid because there is no way to
  149.      convert that reference to a single machine register.  The reload
  150.      pass prevents `subreg' expressions such as these from being formed.
  151.      The first operand of a `subreg' expression is customarily accessed
  152.      with the `SUBREG_REG' macro and the second operand is customarily
  153.      accessed with the `SUBREG_WORD' macro.
  154. `(scratch:M)'
  155.      This represents a scratch register that will be required for the
  156.      execution of a single instruction and not used subsequently.  It is
  157.      converted into a `reg' by either the local register allocator or
  158.      the reload pass.
  159.      `scratch' is usually present inside a `clobber' operation (*note
  160.      Side Effects::.).
  161. `(cc0)'
  162.      This refers to the machine's condition code register.  It has no
  163.      operands and may not have a machine mode.  There are two ways to
  164.      use it:
  165.         * To stand for a complete set of condition code flags.  This is
  166.           best on most machines, where each comparison sets the entire
  167.           series of flags.
  168.           With this technique, `(cc0)' may be validly used in only two
  169.           contexts: as the destination of an assignment (in test and
  170.           compare instructions) and in comparison operators comparing
  171.           against zero (`const_int' with value zero; that is to say,
  172.           `const0_rtx').
  173.         * To stand for a single flag that is the result of a single
  174.           condition.  This is useful on machines that have only a
  175.           single flag bit, and in which comparison instructions must
  176.           specify the condition to test.
  177.           With this technique, `(cc0)' may be validly used in only two
  178.           contexts: as the destination of an assignment (in test and
  179.           compare instructions) where the source is a comparison
  180.           operator, and as the first operand of `if_then_else' (in a
  181.           conditional branch).
  182.      There is only one expression object of code `cc0'; it is the value
  183.      of the variable `cc0_rtx'.  Any attempt to create an expression of
  184.      code `cc0' will return `cc0_rtx'.
  185.      Instructions can set the condition code implicitly.  On many
  186.      machines, nearly all instructions set the condition code based on
  187.      the value that they compute or store.  It is not necessary to
  188.      record these actions explicitly in the RTL because the machine
  189.      description includes a prescription for recognizing the
  190.      instructions that do so (by means of the macro
  191.      `NOTICE_UPDATE_CC').  *Note Condition Code::.  Only instructions
  192.      whose sole purpose is to set the condition code, and instructions
  193.      that use the condition code, need mention `(cc0)'.
  194.      On some machines, the condition code register is given a register
  195.      number and a `reg' is used instead of `(cc0)'.  This is usually the
  196.      preferable approach if only a small subset of instructions modify
  197.      the condition code.  Other machines store condition codes in
  198.      general registers; in such cases a pseudo register should be used.
  199.      Some machines, such as the Sparc and RS/6000, have two sets of
  200.      arithmetic instructions, one that sets and one that does not set
  201.      the condition code.  This is best handled by normally generating
  202.      the instruction that does not set the condition code, and making a
  203.      pattern that both performs the arithmetic and sets the condition
  204.      code register (which would not be `(cc0)' in this case).  For
  205.      examples, search for `addcc' and `andcc' in `sparc.md'.
  206. `(pc)'
  207.      This represents the machine's program counter.  It has no operands
  208.      and may not have a machine mode.  `(pc)' may be validly used only
  209.      in certain specific contexts in jump instructions.
  210.      There is only one expression object of code `pc'; it is the value
  211.      of the variable `pc_rtx'.  Any attempt to create an expression of
  212.      code `pc' will return `pc_rtx'.
  213.      All instructions that do not jump alter the program counter
  214.      implicitly by incrementing it, but there is no need to mention
  215.      this in the RTL.
  216. `(mem:M ADDR)'
  217.      This RTX represents a reference to main memory at an address
  218.      represented by the expression ADDR.  M specifies how large a unit
  219.      of memory is accessed.
  220. File: gcc.info,  Node: Arithmetic,  Next: Comparisons,  Prev: Regs and Memory,  Up: RTL
  221. RTL Expressions for Arithmetic
  222. ==============================
  223.    Unless otherwise specified, all the operands of arithmetic
  224. expressions must be valid for mode M.  An operand is valid for mode M
  225. if it has mode M, or if it is a `const_int' or `const_double' and M is
  226. a mode of class `MODE_INT'.
  227.    For commutative binary operations, constants should be placed in the
  228. second operand.
  229. `(plus:M X Y)'
  230.      Represents the sum of the values represented by X and Y carried
  231.      out in machine mode M.
  232. `(lo_sum:M X Y)'
  233.      Like `plus', except that it represents that sum of X and the
  234.      low-order bits of Y.  The number of low order bits is
  235.      machine-dependent but is normally the number of bits in a `Pmode'
  236.      item minus the number of bits set by the `high' code (*note
  237.      Constants::.).
  238.      M should be `Pmode'.
  239. `(minus:M X Y)'
  240.      Like `plus' but represents subtraction.
  241. `(compare:M X Y)'
  242.      Represents the result of subtracting Y from X for purposes of
  243.      comparison.  The result is computed without overflow, as if with
  244.      infinite precision.
  245.      Of course, machines can't really subtract with infinite precision.
  246.      However, they can pretend to do so when only the sign of the
  247.      result will be used, which is the case when the result is stored
  248.      in the condition code.   And that is the only way this kind of
  249.      expression may validly be used: as a value to be stored in the
  250.      condition codes.
  251.      The mode M is not related to the modes of X and Y, but instead is
  252.      the mode of the condition code value.  If `(cc0)' is used, it is
  253.      `VOIDmode'.  Otherwise it is some mode in class `MODE_CC', often
  254.      `CCmode'.  *Note Condition Code::.
  255.      Normally, X and Y must have the same mode.  Otherwise, `compare'
  256.      is valid only if the mode of X is in class `MODE_INT' and Y is a
  257.      `const_int' or `const_double' with mode `VOIDmode'.  The mode of X
  258.      determines what mode the comparison is to be done in; thus it must
  259.      not be `VOIDmode'.
  260.      If one of the operands is a constant, it should be placed in the
  261.      second operand and the comparison code adjusted as appropriate.
  262.      A `compare' specifying two `VOIDmode' constants is not valid since
  263.      there is no way to know in what mode the comparison is to be
  264.      performed; the comparison must either be folded during the
  265.      compilation or the first operand must be loaded into a register
  266.      while its mode is still known.
  267. `(neg:M X)'
  268.      Represents the negation (subtraction from zero) of the value
  269.      represented by X, carried out in mode M.
  270. `(mult:M X Y)'
  271.      Represents the signed product of the values represented by X and Y
  272.      carried out in machine mode M.
  273.      Some machines support a multiplication that generates a product
  274.      wider than the operands.  Write the pattern for this as
  275.           (mult:M (sign_extend:M X) (sign_extend:M Y))
  276.      where M is wider than the modes of X and Y, which need not be the
  277.      same.
  278.      Write patterns for unsigned widening multiplication similarly using
  279.      `zero_extend'.
  280. `(div:M X Y)'
  281.      Represents the quotient in signed division of X by Y, carried out
  282.      in machine mode M.  If M is a floating point mode, it represents
  283.      the exact quotient; otherwise, the integerized quotient.
  284.      Some machines have division instructions in which the operands and
  285.      quotient widths are not all the same; you should represent such
  286.      instructions using `truncate' and `sign_extend' as in,
  287.           (truncate:M1 (div:M2 X (sign_extend:M2 Y)))
  288. `(udiv:M X Y)'
  289.      Like `div' but represents unsigned division.
  290. `(mod:M X Y)'
  291. `(umod:M X Y)'
  292.      Like `div' and `udiv' but represent the remainder instead of the
  293.      quotient.
  294. `(smin:M X Y)'
  295. `(smax:M X Y)'
  296.      Represents the smaller (for `smin') or larger (for `smax') of X
  297.      and Y, interpreted as signed integers in mode M.
  298. `(umin:M X Y)'
  299. `(umax:M X Y)'
  300.      Like `smin' and `smax', but the values are interpreted as unsigned
  301.      integers.
  302. `(not:M X)'
  303.      Represents the bitwise complement of the value represented by X,
  304.      carried out in mode M, which must be a fixed-point machine mode.
  305. `(and:M X Y)'
  306.      Represents the bitwise logical-and of the values represented by X
  307.      and Y, carried out in machine mode M, which must be a fixed-point
  308.      machine mode.
  309. `(ior:M X Y)'
  310.      Represents the bitwise inclusive-or of the values represented by X
  311.      and Y, carried out in machine mode M, which must be a fixed-point
  312.      mode.
  313. `(xor:M X Y)'
  314.      Represents the bitwise exclusive-or of the values represented by X
  315.      and Y, carried out in machine mode M, which must be a fixed-point
  316.      mode.
  317. `(ashift:M X C)'
  318.      Represents the result of arithmetically shifting X left by C
  319.      places.  X have mode M, a fixed-point machine mode.  C be a
  320.      fixed-point mode or be a constant with mode `VOIDmode'; which mode
  321.      is determined by the mode called for in the machine description
  322.      entry for the left-shift instruction.  For example, on the Vax,
  323.      the mode of C is `QImode' regardless of M.
  324. `(lshiftrt:M X C)'
  325. `(ashiftrt:M X C)'
  326.      Like `ashift' but for right shift.  Unlike the case for left shift,
  327.      these two operations are distinct.
  328. `(rotate:M X C)'
  329. `(rotatert:M X C)'
  330.      Similar but represent left and right rotate.  If C is a constant,
  331.      use `rotate'.
  332. `(abs:M X)'
  333.      Represents the absolute value of X, computed in mode M.
  334. `(sqrt:M X)'
  335.      Represents the square root of X, computed in mode M.  Most often M
  336.      will be a floating point mode.
  337. `(ffs:M X)'
  338.      Represents one plus the index of the least significant 1-bit in X,
  339.      represented as an integer of mode M.  (The value is zero if X is
  340.      zero.)  The mode of X need not be M; depending on the target
  341.      machine, various mode combinations may be valid.
  342. File: gcc.info,  Node: Comparisons,  Next: Bit Fields,  Prev: Arithmetic,  Up: RTL
  343. Comparison Operations
  344. =====================
  345.    Comparison operators test a relation on two operands and are
  346. considered to represent a machine-dependent nonzero value described by,
  347. but not necessarily equal to, `STORE_FLAG_VALUE' (*note Misc::.) if the
  348. relation holds, or zero if it does not.  The mode of the comparison
  349. operation is independent of the mode of the data being compared.  If
  350. the comparison operation is being tested (e.g., the first operand of an
  351. `if_then_else'), the mode must be `VOIDmode'.  If the comparison
  352. operation is producing data to be stored in some variable, the mode
  353. must be in class `MODE_INT'.  All comparison operations producing data
  354. must use the same mode, which is machine-specific.
  355.    There are two ways that comparison operations may be used.  The
  356. comparison operators may be used to compare the condition codes `(cc0)'
  357. against zero, as in `(eq (cc0) (const_int 0))'.  Such a construct
  358. actually refers to the result of the preceding instruction in which the
  359. condition codes were set.  The instructing setting the condition code
  360. must be adjacent to the instruction using the condition code; only
  361. `note' insns may separate them.
  362.    Alternatively, a comparison operation may directly compare two data
  363. objects.  The mode of the comparison is determined by the operands; they
  364. must both be valid for a common machine mode.  A comparison with both
  365. operands constant would be invalid as the machine mode could not be
  366. deduced from it, but such a comparison should never exist in RTL due to
  367. constant folding.
  368.    In the example above, if `(cc0)' were last set to `(compare X Y)',
  369. the comparison operation is identical to `(eq X Y)'.  Usually only one
  370. style of comparisons is supported on a particular machine, but the
  371. combine pass will try to merge the operations to produce the `eq' shown
  372. in case it exists in the context of the particular insn involved.
  373.    Inequality comparisons come in two flavors, signed and unsigned.
  374. Thus, there are distinct expression codes `gt' and `gtu' for signed and
  375. unsigned greater-than.  These can produce different results for the same
  376. pair of integer values: for example, 1 is signed greater-than -1 but not
  377. unsigned greater-than, because -1 when regarded as unsigned is actually
  378. `0xffffffff' which is greater than 1.
  379.    The signed comparisons are also used for floating point values.
  380. Floating point comparisons are distinguished by the machine modes of
  381. the operands.
  382. `(eq:M X Y)'
  383.      1 if the values represented by X and Y are equal, otherwise 0.
  384. `(ne:M X Y)'
  385.      1 if the values represented by X and Y are not equal, otherwise 0.
  386. `(gt:M X Y)'
  387.      1 if the X is greater than Y.  If they are fixed-point, the
  388.      comparison is done in a signed sense.
  389. `(gtu:M X Y)'
  390.      Like `gt' but does unsigned comparison, on fixed-point numbers
  391.      only.
  392. `(lt:M X Y)'
  393. `(ltu:M X Y)'
  394.      Like `gt' and `gtu' but test for "less than".
  395. `(ge:M X Y)'
  396. `(geu:M X Y)'
  397.      Like `gt' and `gtu' but test for "greater than or equal".
  398. `(le:M X Y)'
  399. `(leu:M X Y)'
  400.      Like `gt' and `gtu' but test for "less than or equal".
  401. `(if_then_else COND THEN ELSE)'
  402.      This is not a comparison operation but is listed here because it is
  403.      always used in conjunction with a comparison operation.  To be
  404.      precise, COND is a comparison expression.  This expression
  405.      represents a choice, according to COND, between the value
  406.      represented by THEN and the one represented by ELSE.
  407.      On most machines, `if_then_else' expressions are valid only to
  408.      express conditional jumps.
  409. `(cond [TEST1 VALUE1 TEST2 VALUE2 ...] DEFAULT)'
  410.      Similar to `if_then_else', but more general.  Each of TEST1,
  411.      TEST2, ... is performed in turn.  The result of this expression is
  412.      the VALUE corresponding to the first non-zero test, or DEFAULT if
  413.      none of the tests are non-zero expressions.
  414.      This is currently not valid for instruction patterns and is
  415.      supported only for insn attributes.  *Note Insn Attributes::.
  416. File: gcc.info,  Node: Bit Fields,  Next: Conversions,  Prev: Comparisons,  Up: RTL
  417. Bit Fields
  418. ==========
  419.    Special expression codes exist to represent bitfield instructions.
  420. These types of expressions are lvalues in RTL; they may appear on the
  421. left side of an assignment, indicating insertion of a value into the
  422. specified bit field.
  423. `(sign_extract:M LOC SIZE POS)'
  424.      This represents a reference to a sign-extended bit field contained
  425.      or starting in LOC (a memory or register reference).  The bit field
  426.      is SIZE bits wide and starts at bit POS.  The compilation option
  427.      `BITS_BIG_ENDIAN' says which end of the memory unit POS counts
  428.      from.
  429.      If LOC is in memory, its mode must be a single-byte integer mode.
  430.      If LOC is in a register, the mode to use is specified by the
  431.      operand of the `insv' or `extv' pattern (*note Standard Names::.)
  432.      and is usually a full-word integer mode.
  433.      The mode of POS is machine-specific and is also specified in the
  434.      `insv' or `extv' pattern.
  435.      The mode M is the same as the mode that would be used for LOC if
  436.      it were a register.
  437. `(zero_extract:M LOC SIZE POS)'
  438.      Like `sign_extract' but refers to an unsigned or zero-extended bit
  439.      field.  The same sequence of bits are extracted, but they are
  440.      filled to an entire word with zeros instead of by sign-extension.
  441. File: gcc.info,  Node: Conversions,  Next: RTL Declarations,  Prev: Bit Fields,  Up: RTL
  442. Conversions
  443. ===========
  444.    All conversions between machine modes must be represented by
  445. explicit conversion operations.  For example, an expression which is
  446. the sum of a byte and a full word cannot be written as `(plus:SI
  447. (reg:QI 34) (reg:SI 80))' because the `plus' operation requires two
  448. operands of the same machine mode.  Therefore, the byte-sized operand
  449. is enclosed in a conversion operation, as in
  450.      (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
  451.    The conversion operation is not a mere placeholder, because there
  452. may be more than one way of converting from a given starting mode to
  453. the desired final mode.  The conversion operation code says how to do
  454.    For all conversion operations, X must not be `VOIDmode' because the
  455. mode in which to do the conversion would not be known.  The conversion
  456. must either be done at compile-time or X must be placed into a register.
  457. `(sign_extend:M X)'
  458.      Represents the result of sign-extending the value X to machine
  459.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  460.      a mode narrower than M.
  461. `(zero_extend:M X)'
  462.      Represents the result of zero-extending the value X to machine
  463.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  464.      a mode narrower than M.
  465. `(float_extend:M X)'
  466.      Represents the result of extending the value X to machine mode M.
  467.      m must be a floating point mode and X a floating point value of a
  468.      mode narrower than M.
  469. `(truncate:M X)'
  470.      Represents the result of truncating the value X to machine mode M.
  471.      M must be a fixed-point mode and X a fixed-point value of a mode
  472.      wider than M.
  473. `(float_truncate:M X)'
  474.      Represents the result of truncating the value X to machine mode M.
  475.      M must be a floating point mode and X a floating point value of a
  476.      mode wider than M.
  477. `(float:M X)'
  478.      Represents the result of converting fixed point value X, regarded
  479.      as signed, to floating point mode M.
  480. `(unsigned_float:M X)'
  481.      Represents the result of converting fixed point value X, regarded
  482.      as unsigned, to floating point mode M.
  483. `(fix:M X)'
  484.      When M is a fixed point mode, represents the result of converting
  485.      floating point value X to mode M, regarded as signed.  How
  486.      rounding is done is not specified, so this operation may be used
  487.      validly in compiling C code only for integer-valued operands.
  488. `(unsigned_fix:M X)'
  489.      Represents the result of converting floating point value X to
  490.      fixed point mode M, regarded as unsigned.  How rounding is done is
  491.      not specified.
  492. `(fix:M X)'
  493.      When M is a floating point mode, represents the result of
  494.      converting floating point value X (valid for mode M) to an
  495.      integer, still represented in floating point mode M, by rounding
  496.      towards zero.
  497. File: gcc.info,  Node: RTL Declarations,  Next: Side Effects,  Prev: Conversions,  Up: RTL
  498. Declarations
  499. ============
  500.    Declaration expression codes do not represent arithmetic operations
  501. but rather state assertions about their operands.
  502. `(strict_low_part (subreg:M (reg:N R) 0))'
  503.      This expression code is used in only one context: as the
  504.      destination operand of a `set' expression.  In addition, the
  505.      operand of this expression must be a non-paradoxical `subreg'
  506.      expression.
  507.      The presence of `strict_low_part' says that the part of the
  508.      register which is meaningful in mode N, but is not part of mode M,
  509.      is not to be altered.  Normally, an assignment to such a subreg is
  510.      allowed to have undefined effects on the rest of the register when
  511.      M is less than a word.
  512. File: gcc.info,  Node: Side Effects,  Next: Incdec,  Prev: RTL Declarations,  Up: RTL
  513. Side Effect Expressions
  514. =======================
  515.    The expression codes described so far represent values, not actions.
  516. But machine instructions never produce values; they are meaningful only
  517. for their side effects on the state of the machine.  Special expression
  518. codes are used to represent side effects.
  519.    The body of an instruction is always one of these side effect codes;
  520. the codes described above, which represent values, appear only as the
  521. operands of these.
  522. `(set LVAL X)'
  523.      Represents the action of storing the value of X into the place
  524.      represented by LVAL.  LVAL must be an expression representing a
  525.      place that can be stored in: `reg' (or `subreg' or
  526.      `strict_low_part'), `mem', `pc' or `cc0'.
  527.      If LVAL is a `reg', `subreg' or `mem', it has a machine mode; then
  528.      X must be valid for that mode.
  529.      If LVAL is a `reg' whose machine mode is less than the full width
  530.      of the register, then it means that the part of the register
  531.      specified by the machine mode is given the specified value and the
  532.      rest of the register receives an undefined value.  Likewise, if
  533.      LVAL is a `subreg' whose machine mode is narrower than the mode of
  534.      the register, the rest of the register can be changed in an
  535.      undefined way.
  536.      If LVAL is a `strict_low_part' of a `subreg', then the part of the
  537.      register specified by the machine mode of the `subreg' is given
  538.      the value X and the rest of the register is not changed.
  539.      If LVAL is `(cc0)', it has no machine mode, and X may be either a
  540.      `compare' expression or a value that may have any mode.  The
  541.      latter case represents a "test" instruction.  The expression `(set
  542.      (cc0) (reg:M N))' is equivalent to `(set (cc0) (compare (reg:M N)
  543.      (const_int 0)))'.  Use the former expression to save space during
  544.      the compilation.
  545.      If LVAL is `(pc)', we have a jump instruction, and the
  546.      possibilities for X are very limited.  It may be a `label_ref'
  547.      expression (unconditional jump).  It may be an `if_then_else'
  548.      (conditional jump), in which case either the second or the third
  549.      operand must be `(pc)' (for the case which does not jump) and the
  550.      other of the two must be a `label_ref' (for the case which does
  551.      jump).  X may also be a `mem' or `(plus:SI (pc) Y)', where Y may
  552.      be a `reg' or a `mem'; these unusual patterns are used to
  553.      represent jumps through branch tables.
  554.      If LVAL is neither `(cc0)' nor `(pc)', the mode of LVAL must not
  555.      be `VOIDmode' and the mode of X must be valid for the mode of LVAL.
  556.      LVAL is customarily accessed with the `SET_DEST' macro and X with
  557.      the `SET_SRC' macro.
  558. `(return)'
  559.      As the sole expression in a pattern, represents a return from the
  560.      current function, on machines where this can be done with one
  561.      instruction, such as Vaxes.  On machines where a multi-instruction
  562.      "epilogue" must be executed in order to return from the function,
  563.      returning is done by jumping to a label which precedes the
  564.      epilogue, and the `return' expression code is never used.
  565.      Inside an `if_then_else' expression, represents the value to be
  566.      placed in `pc' to return to the caller.
  567.      Note that an insn pattern of `(return)' is logically equivalent to
  568.      `(set (pc) (return))', but the latter form is never used.
  569. `(call FUNCTION NARGS)'
  570.      Represents a function call.  FUNCTION is a `mem' expression whose
  571.      address is the address of the function to be called.  NARGS is an
  572.      expression which can be used for two purposes: on some machines it
  573.      represents the number of bytes of stack argument; on others, it
  574.      represents the number of argument registers.
  575.      Each machine has a standard machine mode which FUNCTION must have.
  576.      The machine description defines macro `FUNCTION_MODE' to expand
  577.      into the requisite mode name.  The purpose of this mode is to
  578.      specify what kind of addressing is allowed, on machines where the
  579.      allowed kinds of addressing depend on the machine mode being
  580.      addressed.
  581. `(clobber X)'
  582.      Represents the storing or possible storing of an unpredictable,
  583.      undescribed value into X, which must be a `reg', `scratch' or
  584.      `mem' expression.
  585.      One place this is used is in string instructions that store
  586.      standard values into particular hard registers.  It may not be
  587.      worth the trouble to describe the values that are stored, but it
  588.      is essential to inform the compiler that the registers will be
  589.      altered, lest it attempt to keep data in them across the string
  590.      instruction.
  591.      If X is `(mem:BLK (const_int 0))', it means that all memory
  592.      locations must be presumed clobbered.
  593.      Note that the machine description classifies certain hard
  594.      registers as "call-clobbered".  All function call instructions are
  595.      assumed by default to clobber these registers, so there is no need
  596.      to use `clobber' expressions to indicate this fact.  Also, each
  597.      function call is assumed to have the potential to alter any memory
  598.      location, unless the function is declared `const'.
  599.      If the last group of expressions in a `parallel' are each a
  600.      `clobber' expression whose arguments are `reg' or `match_scratch'
  601.      (*note RTL Template::.) expressions, the combiner phase can add
  602.      the appropriate `clobber' expressions to an insn it has
  603.      constructed when doing so will cause a pattern to be matched.
  604.      This feature can be used, for example, on a machine that whose
  605.      multiply and add instructions don't use an MQ register but which
  606.      has an add-accumulate instruction that does clobber the MQ
  607.      register.  Similarly, a combined instruction might require a
  608.      temporary register while the constituent instructions might not.
  609.      When a `clobber' expression for a register appears inside a
  610.      `parallel' with other side effects, the register allocator
  611.      guarantees that the register is unoccupied both before and after
  612.      that insn.  However, the reload phase may allocate a register used
  613.      for one of the inputs unless the `&' constraint is specified for
  614.      the selected alternative (*note Modifiers::.).  You can clobber
  615.      either a specific hard register, a pseudo register, or a `scratch'
  616.      expression; in the latter two cases, GNU CC will allocate a hard
  617.      register that is available there for use as a temporary.
  618.      For instructions that require a temporary register, you should use
  619.      `scratch' instead of a pseudo-register because this will allow the
  620.      combiner phase to add the `clobber' when required.  You do this by
  621.      coding (`clobber' (`match_scratch' ...)).  If you do clobber a
  622.      pseudo register, use one which appears nowhere else--generate a
  623.      new one each time.  Otherwise, you may confuse CSE.
  624.      There is one other known use for clobbering a pseudo register in a
  625.      `parallel': when one of the input operands of the insn is also
  626.      clobbered by the insn.  In this case, using the same pseudo
  627.      register in the clobber and elsewhere in the insn produces the
  628.      expected results.
  629. `(use X)'
  630.      Represents the use of the value of X.  It indicates that the value
  631.      in X at this point in the program is needed, even though it may
  632.      not be apparent why this is so.  Therefore, the compiler will not
  633.      attempt to delete previous instructions whose only effect is to
  634.      store a value in X.  X must be a `reg' expression.
  635.      During the delayed branch scheduling phase, X may be an insn.
  636.      This indicates that X previously was located at this place in the
  637.      code and its data dependencies need to be taken into account.
  638.      These `use' insns will be deleted before the delayed branch
  639.      scheduling phase exits.
  640. `(parallel [X0 X1 ...])'
  641.      Represents several side effects performed in parallel.  The square
  642.      brackets stand for a vector; the operand of `parallel' is a vector
  643.      of expressions.  X0, X1 and so on are individual side effect
  644.      expressions--expressions of code `set', `call', `return',
  645.      `clobber' or `use'.
  646.      "In parallel" means that first all the values used in the
  647.      individual side-effects are computed, and second all the actual
  648.      side-effects are performed.  For example,
  649.           (parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
  650.                      (set (mem:SI (reg:SI 1)) (reg:SI 1))])
  651.      says unambiguously that the values of hard register 1 and the
  652.      memory location addressed by it are interchanged.  In both places
  653.      where `(reg:SI 1)' appears as a memory address it refers to the
  654.      value in register 1 *before* the execution of the insn.
  655.      It follows that it is *incorrect* to use `parallel' and expect the
  656.      result of one `set' to be available for the next one.  For
  657.      example, people sometimes attempt to represent a jump-if-zero
  658.      instruction this way:
  659.           (parallel [(set (cc0) (reg:SI 34))
  660.                      (set (pc) (if_then_else
  661.                                   (eq (cc0) (const_int 0))
  662.                                   (label_ref ...)
  663.                                   (pc)))])
  664.      But this is incorrect, because it says that the jump condition
  665.      depends on the condition code value *before* this instruction, not
  666.      on the new value that is set by this instruction.
  667.      Peephole optimization, which takes place together with final
  668.      assembly code output, can produce insns whose patterns consist of
  669.      a `parallel' whose elements are the operands needed to output the
  670.      resulting assembler code--often `reg', `mem' or constant
  671.      expressions.  This would not be well-formed RTL at any other stage
  672.      in compilation, but it is ok then because no further optimization
  673.      remains to be done.  However, the definition of the macro
  674.      `NOTICE_UPDATE_CC', if any, must deal with such insns if you
  675.      define any peephole optimizations.
  676. `(sequence [INSNS ...])'
  677.      Represents a sequence of insns.  Each of the INSNS that appears in
  678.      the vector is suitable for appearing in the chain of insns, so it
  679.      must be an `insn', `jump_insn', `call_insn', `code_label',
  680.      `barrier' or `note'.
  681.      A `sequence' RTX is never placed in an actual insn during RTL
  682.      generation.  It represents the sequence of insns that result from a
  683.      `define_expand' *before* those insns are passed to `emit_insn' to
  684.      insert them in the chain of insns.  When actually inserted, the
  685.      individual sub-insns are separated out and the `sequence' is
  686.      forgotten.
  687.      After delay-slot scheduling is completed, an insn and all the
  688.      insns that reside in its delay slots are grouped together into a
  689.      `sequence'.  The insn requiring the delay slot is the first insn
  690.      in the vector; subsequent insns are to be placed in the delay slot.
  691.      `INSN_ANNULLED_BRANCH_P' is set on an insn in a delay slot to
  692.      indicate that a branch insn should be used that will conditionally
  693.      annul the effect of the insns in the delay slots.  In such a case,
  694.      `INSN_FROM_TARGET_P' indicates that the insn is from the target of
  695.      the branch and should be executed only if the branch is taken;
  696.      otherwise the insn should be executed only if the branch is not
  697.      taken.  *Note Delay Slots::.
  698.    These expression codes appear in place of a side effect, as the body
  699. of an insn, though strictly speaking they do not always describe side
  700. effects as such:
  701. `(asm_input S)'
  702.      Represents literal assembler code as described by the string S.
  703. `(unspec [OPERANDS ...] INDEX)'
  704. `(unspec_volatile [OPERANDS ...] INDEX)'
  705.      Represents a machine-specific operation on OPERANDS.  INDEX
  706.      selects between multiple machine-specific operations.
  707.      `unspec_volatile' is used for volatile operations and operations
  708.      that may trap; `unspec' is used for other operations.
  709.      These codes may appear inside a `pattern' of an insn, inside a
  710.      `parallel', or inside an expression.
  711. `(addr_vec:M [LR0 LR1 ...])'
  712.      Represents a table of jump addresses.  The vector elements LR0,
  713.      etc., are `label_ref' expressions.  The mode M specifies how much
  714.      space is given to each address; normally M would be `Pmode'.
  715. `(addr_diff_vec:M BASE [LR0 LR1 ...])'
  716.      Represents a table of jump addresses expressed as offsets from
  717.      BASE.  The vector elements LR0, etc., are `label_ref' expressions
  718.      and so is BASE.  The mode M specifies how much space is given to
  719.      each address-difference.
  720. File: gcc.info,  Node: Incdec,  Next: Assembler,  Prev: Side Effects,  Up: RTL
  721. Embedded Side-Effects on Addresses
  722. ==================================
  723.    Four special side-effect expression codes appear as memory addresses.
  724. `(pre_dec:M X)'
  725.      Represents the side effect of decrementing X by a standard amount
  726.      and represents also the value that X has after being decremented.
  727.      x must be a `reg' or `mem', but most machines allow only a `reg'.
  728.      m must be the machine mode for pointers on the machine in use.
  729.      The amount X is decremented by is the length in bytes of the
  730.      machine mode of the containing memory reference of which this
  731.      expression serves as the address.  Here is an example of its use:
  732.           (mem:DF (pre_dec:SI (reg:SI 39)))
  733.      This says to decrement pseudo register 39 by the length of a
  734.      `DFmode' value and use the result to address a `DFmode' value.
  735. `(pre_inc:M X)'
  736.      Similar, but specifies incrementing X instead of decrementing it.
  737. `(post_dec:M X)'
  738.      Represents the same side effect as `pre_dec' but a different
  739.      value.  The value represented here is the value X has before being
  740.      decremented.
  741. `(post_inc:M X)'
  742.      Similar, but specifies incrementing X instead of decrementing it.
  743.    These embedded side effect expressions must be used with care.
  744. Instruction patterns may not use them.  Until the `flow' pass of the
  745. compiler, they may occur only to represent pushes onto the stack.  The
  746. `flow' pass finds cases where registers are incremented or decremented
  747. in one instruction and used as an address shortly before or after;
  748. these cases are then transformed to use pre- or post-increment or
  749. -decrement.
  750.    If a register used as the operand of these expressions is used in
  751. another address in an insn, the original value of the register is used.
  752. Uses of the register outside of an address are not permitted within the
  753. same insn as a use in an embedded side effect expression because such
  754. insns behave differently on different machines and hence must be treated
  755. as ambiguous and disallowed.
  756.    An instruction that can be represented with an embedded side effect
  757. could also be represented using `parallel' containing an additional
  758. `set' to describe how the address register is altered.  This is not
  759. done because machines that allow these operations at all typically
  760. allow them wherever a memory address is called for.  Describing them as
  761. additional parallel stores would require doubling the number of entries
  762. in the machine description.
  763. File: gcc.info,  Node: Assembler,  Next: Insns,  Prev: Incdec,  Up: RTL
  764. Assembler Instructions as Expressions
  765. =====================================
  766.    The RTX code `asm_operands' represents a value produced by a
  767. user-specified assembler instruction.  It is used to represent an `asm'
  768. statement with arguments.  An `asm' statement with a single output
  769. operand, like this:
  770.      asm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
  771. is represented using a single `asm_operands' RTX which represents the
  772. value that is stored in `outputvar':
  773.      (set RTX-FOR-OUTPUTVAR
  774.           (asm_operands "foo %1,%2,%0" "a" 0
  775.                         [RTX-FOR-ADDITION-RESULT RTX-FOR-*Z]
  776.                         [(asm_input:M1 "g")
  777.                          (asm_input:M2 "di")]))
  778. Here the operands of the `asm_operands' RTX are the assembler template
  779. string, the output-operand's constraint, the index-number of the output
  780. operand among the output operands specified, a vector of input operand
  781. RTX's, and a vector of input-operand modes and constraints.  The mode
  782. M1 is the mode of the sum `x+y'; M2 is that of `*z'.
  783.    When an `asm' statement has multiple output values, its insn has
  784. several such `set' RTX's inside of a `parallel'.  Each `set' contains a
  785. `asm_operands'; all of these share the same assembler template and
  786. vectors, but each contains the constraint for the respective output
  787. operand.  They are also distinguished by the output-operand index
  788. number, which is 0, 1, ... for successive output operands.
  789.